{include file="admin/header.tpl" title="header" }
<div id="content">
      {php} echo display_msg(); {/php}
      <h2>Banners</h2>
      
      <div class="lstable">
       <form action="{$baseurl}/admin/banners.php" method="get">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="8%" align="left" valign="middle"><strong>Name :</strong></td>
            <td width="27%" align="left" valign="middle"><input type="text" name="banner_name" id="banner_name" value="{$post.banner_name}"  /></td>
            <td width="65%">&nbsp;</td>
          </tr>
           <tr>
            <td align="left" valign="middle">&nbsp;</td>
            <td align="left" valign="middle">
            	 <input type="submit"  class="btncss" name="submit"  value="Search" /> &nbsp;
                <input class="btncss" type="button" onclick="location.href='{$baseurl}/admin/banners.php'" value="Reset" />
               </td>
          </tr>
        </table>
        </form>
      </div>
      <div><img src="{$admin_imgurl}/spacer.gif" width="1" height="25" alt="spacer" /></div>
      
      <div>
      	<div class="admorep" align="right"><a href="{$baseurl}/admin/banners.php?action=add">Add More Banner</a></div>
        <table cellspacing="0" cellpadding="0" class="engineTable">
          <thead>
            <tr >
              <th width="8%" align="center" valign="top" > Sr. No</th>
              <th width="35%" align="left" valign="top"> Name</th>
              <th width="25%" align="left" valign="top">link</th>
              <th width="25%" align="left" valign="top">image</th>
              
              <th width="12%" align="center" valign="top" colspan="3">Actions</th>
            </tr>
          </thead>
          <tbody>
          {assign var='counter' value=$pagination_start}
       		{foreach from=$banner_list item=row}
            {assign var='counter' value=$counter+1}     
            <tr class="{cycle values="even,odd"}">
              <td align="center" valign="top">{$counter}</td>
              <td align="left" valign="top">{$row.banner_name}</td>
              <td align="left" valign="top">{$row.banner_link}</td>
              <td align="left" valign="top">
              	<a rel="facebox" class="thumbnail" href="{$baseurl}/images/banners/{$row.banner_image}">
               		<img src="{$baseurl}/images/banners/{$row.banner_image}" width="25" height="25" border="0" />
                	<span><img src="{$baseurl}/images/banners/{$row.banner_image}" width="150"  /><br /> {$row.banner_image}</span>
               </a>
              </td>
              
              <td>
              	<a title="Deactivate" style="display:{if $row.status eq 1}{else}none{/if}" onclick="changeStatus({$row.banner_id}, 0)" id="active_{$row.banner_id}" href="javascript:void(0)"> <img src="{$admin_imgurl}/active.png"/> </a>
                <a title="Activate" style="display:{if $row.status ne 1}{else}none{/if}" onclick="changeStatus({$row.banner_id}, 1)" id="deactive_{$row.banner_id}" href="javascript:void(0)"> <img src="{$admin_imgurl}/deactive.png"/> </a>
              	<span id="loader_{$row.banner_id}" style="display:none;"><img width="14" height="14" src="{$admin_imgurl}/loading.gif"></span>	
                                 
              </td>
              
              
              <td align="center"> <a title="Edit"  href="{$baseurl}/admin/banners.php?action=edit&banner_id={$row.banner_id}&pg={$post.pg}&ipp={$post.ipp}&new_page_limit={$post.new_page_limit}&username={$post.banner_name}"> <img src="{$admin_imgurl}/edit.png"/> </a> </td>
              <td align="center"><a title="Delete" href="{$baseurl}/admin/banners.php?action=delete&banner_id={$row.banner_id}" onClick="return confirm('Are You Sure To Delete?')"><img src="{$admin_imgurl}/del.png"  /> </a></td>
            </tr>
        	{foreachelse}
           <tr><td colspan="10" align="center"> No Record Found </td></tr>
       	 {/foreach}
            
          </tbody>
        </table>
        <div class="pagination tn"> {$pagination}
          <div class="page_limit_div">
        		 {$page_limit_select}
	        </div>
          <div class="totalno"><strong>Total Records:</strong> {$total_records}</div>
          <div class="clear"></div>
        </div>
      </div>
    </div>
    
    <script>
	{literal}
	
		function changeStatus(banner_id, status)
		{
			
			$('#deactive_'+banner_id).hide();
			$('#active_'+banner_id).hide();
			$('#loader_'+banner_id).show();

			$.post(
				"banners.php", {action : "changeStatus", banner_id : banner_id, status : status},
				function(data) 
				{
					if( status == 0 )	{
						$('#deactive_'+banner_id).show();
						$('#active_'+banner_id).hide();	
					} else {
						$('#deactive_'+banner_id).hide();
						$('#active_'+banner_id).show();	
					}
					$('#loader_'+banner_id).hide();
				} 
			);
		}
	
	
		function mergePlayerStats(player_id)
	{
		
	}
	
	{/literal}
	</script>
    
     {include file="admin/footer.tpl" title="footer"}   